package com.example.kuv;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.util.Log;

public class AlertUtil {
    /**
     * Called when a delete button is clicked
     */
    public static void showAlertMessage(final Context context, final int id) {
        AlertDialog.Builder alertDialog = new AlertDialog.Builder(context);
        alertDialog
                .setMessage(context.getString(R.string.delete_message_alert));
        // Update info in adapter when the "OK" button is clicked
        alertDialog.setPositiveButton(context.getString(R.string.ok_button),
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface d, int choice) {
                        EkDatabaseHelper.getCategoryHelper(context).deleteKuv(
                                id);
                        Log.i("AlertUtil", "id: " + id);
                    }
                });

        alertDialog.setNegativeButton(
                context.getString(R.string.cancel_button),
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface d, int choice) {
                    }
                });
        alertDialog.show();
    }
}
